package com.itmck.util;

import java.util.List;
import java.util.stream.Collectors;

/**
 * 太阳当空照,花儿对我笑
 * <p>
 * Create by M ChangKe 2021/11/3 21:26
 **/
public class UrlCheckUtils {

    public static boolean checkUrl(List<String> urlList, String url) {
        List<String> collect = urlList.stream().filter(dto -> {
            if (dto.endsWith("**")) {
                String path = dto.substring(0, dto.indexOf("*"));
                return url.indexOf(path) == 0;
            } else {
                return url.indexOf(dto) == 0;
            }
        }).collect(Collectors.toList());
        return !collect.isEmpty();
    }
}